import { post } from "@/utils/request";
import type {
  LoginRequest,
  RegisterRequest,
  LoginResponse,
  ApiResponse,
} from "@/types";

// 登录
export const login = (data: LoginRequest): Promise<ApiResponse<LoginResponse>> => {
  return post("/auth/login", data);
};

// 注册
export const register = (data: RegisterRequest): Promise<ApiResponse<LoginResponse>> => {
  return post("/auth/register", data);
};

// 登出 
export const logout = (): Promise<ApiResponse<void>> => {
  return post("/auth/logout");
};
